sum = 0
(1..999).each do |i|
  if (i%5 == 0 || i%3 == 0)
    sum = sum + i
  end
end
puts sum
